home *** CD-ROM | disk | FTP | other *** search
/ Team Palmtops 7 / Palmtops_numero07.iso / WinCE / SDKWindowsCE / HandHeldPCPro30 / sdk.exe / Jupiter SDK / data1.cab / MFC_Samples / palette / palette.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1999-02-19  |  4.2 KB  |  154 lines

  1. // Palette.cpp : Defines the class behaviors for the application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include "Palette.h"
  6.  
  7. #include "MainFrm.h"
  8. #include "dibdoc.h"
  9. #include "dibview.h"
  10.  
  11. #ifdef _DEBUG
  12. #define new DEBUG_NEW
  13. #undef THIS_FILE
  14. static char THIS_FILE[] = __FILE__;
  15. #endif
  16.  
  17. /////////////////////////////////////////////////////////////////////////////
  18. // CPaletteApp
  19.  
  20. BEGIN_MESSAGE_MAP(CPaletteApp, CWinApp)
  21.     //{{AFX_MSG_MAP(CPaletteApp)
  22.     ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
  23.         // NOTE - the ClassWizard will add and remove mapping macros here.
  24.         //    DO NOT EDIT what you see in these blocks of generated code!
  25.     //}}AFX_MSG_MAP
  26.     // Standard file based document commands
  27.     ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
  28.     ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
  29. END_MESSAGE_MAP()
  30.  
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CPaletteApp construction
  33.  
  34. CPaletteApp::CPaletteApp(LPCTSTR lpszAppName)
  35.     : CWinApp(lpszAppName)
  36. {
  37. }
  38.  
  39. /////////////////////////////////////////////////////////////////////////////
  40. // The one and only CPaletteApp object
  41.  
  42. // WCE MFC apps require the application name to be specified in the CWinApp 
  43. // constructor. A help contents filename may also be specified.
  44.  
  45. CPaletteApp theApp(_T("Palette"));
  46.  
  47. /////////////////////////////////////////////////////////////////////////////
  48. // CPaletteApp initialization
  49.  
  50. BOOL CPaletteApp::InitInstance()
  51. {
  52.     // Standard initialization
  53.     // If you are not using these features and wish to reduce the size
  54.     //  of your final executable, you should remove from the following
  55.     //  the specific initialization routines you do not need.
  56.  
  57.     // Change the registry key under which our settings are stored.
  58.     // You should modify this string to be something appropriate
  59.     // such as the name of your company or organization.
  60.     SetRegistryKey(_T("Local AppWizard-Generated Applications"));
  61.  
  62.     LoadStdProfileSettings();  // Load standard INI file options (including MRU)
  63.  
  64.     // Register the application's document templates.  Document templates
  65.     //  serve as the connection between documents, frame windows and views.
  66.  
  67.     CSingleDocTemplate* pDocTemplate;
  68.     pDocTemplate = new CSingleDocTemplate(
  69.         IDR_MAINFRAME,
  70.         RUNTIME_CLASS(CDibDoc),
  71.         RUNTIME_CLASS(CMainFrame),       // main SDI frame window
  72.         RUNTIME_CLASS(CDibView));
  73.     AddDocTemplate(pDocTemplate);
  74.  
  75.     // Parse command line for standard shell commands, DDE, file open
  76.     CCommandLineInfo cmdInfo;
  77.     ParseCommandLine(cmdInfo);
  78.  
  79.     // Dispatch commands specified on the command line
  80.     if (!ProcessShellCommand(cmdInfo))
  81.         return FALSE;
  82.  
  83.     // The one and only window has been initialized, so show and update it.
  84.     m_pMainWnd->ShowWindow(SW_SHOW);
  85.     m_pMainWnd->UpdateWindow();
  86.  
  87.     return TRUE;
  88. }
  89.  
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CAboutDlg dialog used for App About
  92.  
  93. class CAboutDlg : public CDialog
  94. {
  95. public:
  96.     CAboutDlg();
  97.  
  98. // Dialog Data
  99.     //{{AFX_DATA(CAboutDlg)
  100.     enum { IDD = IDD_ABOUTBOX };
  101.     //}}AFX_DATA
  102.  
  103.     // ClassWizard generated virtual function overrides
  104.     //{{AFX_VIRTUAL(CAboutDlg)
  105.     protected:
  106.     virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
  107.     //}}AFX_VIRTUAL
  108.  
  109. // Implementation
  110. protected:
  111.     //{{AFX_MSG(CAboutDlg)
  112.     virtual BOOL OnInitDialog();        // Added for WCE apps
  113.     //}}AFX_MSG
  114.     DECLARE_MESSAGE_MAP()
  115. };
  116.  
  117. CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD)
  118. {
  119.     //{{AFX_DATA_INIT(CAboutDlg)
  120.     //}}AFX_DATA_INIT
  121. }
  122.  
  123. void CAboutDlg::DoDataExchange(CDataExchange* pDX)
  124. {
  125.     CDialog::DoDataExchange(pDX);
  126.     //{{AFX_DATA_MAP(CAboutDlg)
  127.     //}}AFX_DATA_MAP
  128. }
  129.  
  130. BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
  131.     //{{AFX_MSG_MAP(CAboutDlg)
  132.         // No message handlers
  133.     //}}AFX_MSG_MAP
  134. END_MESSAGE_MAP()
  135.  
  136. // App command to run the dialog
  137. void CPaletteApp::OnAppAbout()
  138. {
  139.     CAboutDlg aboutDlg;
  140.     aboutDlg.DoModal();
  141. }
  142.  
  143. /////////////////////////////////////////////////////////////////////////////
  144. // CPaletteApp commands
  145. // Added for WCE apps
  146.  
  147. BOOL CAboutDlg::OnInitDialog() 
  148. {
  149.     CDialog::OnInitDialog();    
  150.     CenterWindow();    
  151.     return TRUE;  // return TRUE unless you set the focus to a control
  152.                   // EXCEPTION: OCX Property Pages should return FALSE
  153. }
  154.